ERNIE-ViLG AI作画
zhengliang.zhang 2/23/2023 BaiDuAIAIImageMachinelearning视觉模型简单性易用性BrowserNode.js游戏原画设计艺术设计文字成画
# ERNIE-ViLG AI作画
文心ERNIE-ViLG是全球规模最大的中文跨模态生成模型,可基于自然语言智能生成不限定风格的图像,面向有图片创作需求的开发者提供API调用服务,同时开放体验专区方便用户进行创意探索

# 预览图
根据创意描述,风格,艺术家,尺寸生成图片

# 教程
如何使用
注册账号

创建应用

接口调试

# 代码示例
//获取access_token
const request = require('request')
async function main() {
var options = {
'method': 'POST',
'url': 'https://aip.baidubce.com/oauth/2.0/token?client_id=jVDuK4kx0ArjD6Wcxbhi7Do1&client_secret=ao2e97RRLtCeNNKfMseY6UA78ElREade&grant_type=client_credentials',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
}
main();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 利用access_token 访问
const request = require('request')
async function main() {
var options = {
'method': 'POST',
'url': 'https://aip.baidubce.com/rpc/2.0/ernievilg/v1/txt2img?access_token=24.6d3a63df4bbfc6c1f64e8cb00ea885a3.2592000.1679735697.282335-30678479',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
"text": "abc",
"resolution": "1024*1024",
"style": "二次元"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
}
main();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 接口文档
# 效果尝试
| 名称 | 点击访问 |
|---|---|
| 图片创作网址(每天五次免费) | 点击访问 |
| 文心大模型 | 点击访问 |
| 文心一格 | 点击访问 |